<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // var date = new Date();
        // console.log(date);
        // var date1 = new Date("2019-10-1 8:8:8");
        // console.log(date1);
        //格式化日期
        var date = new Date();
        console.log(date.getFullYear());
        console.log(date.getMonth() + 1); //返回的月份小一个月
        var arr = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
        console.log(date.getDay()); //周日返回的是0
        var dates = date.getDate();
        var day = date.getDay()
        console.log(date.getFullYear() + "年" + date.getMonth() + "月" + dates + "日" + arr[day]);
    </script>
</head>

<body>

</body>

</html>